﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QMenu>
#include <QWidget>
#include <QNetworkReply>
#include "citycodeutils.h"
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void onReadData(QNetworkReply *reply);
    void parseWeatherJsonData(QByteArray rawData);
    QString getCitycodeFromUser(QString name);
private slots:
    void on_pb_search_clicked();

private:
    Ui::Widget *ui;
    QMenu *myMenu;
    QPoint offset;
    QString strUrl;
//    QNetworkReply *replay = nullptr;
    CityCodeUtils cityCodeUtils;
    QNetworkAccessManager *manager = nullptr;

};
#endif // WIDGET_H
